<?php
//B2子主题目录url
define( 'B2_CHILD_URI', get_stylesheet_directory_uri() );


add_action( 'wp_enqueue_scripts', 'parent_theme_enqueue_styles',9 );
function parent_theme_enqueue_styles() {
    //加载父主题样式文件
    wp_enqueue_style( 'parent-style-main', get_template_directory_uri() . '/style.css',array() , B2_VERSION, 'all' );
    wp_enqueue_style( 'parent-style', get_template_directory_uri().'/Assets/fontend/style.css',array() , B2_VERSION, 'all');
}

//加载子主题样式
add_action( 'wp_enqueue_scripts', 'child_theme_enqueue_styles',99 );
function child_theme_enqueue_styles() {

    //禁用当前子主题默认加载项
    wp_dequeue_style( 'b2-style-main' );
    wp_dequeue_style( 'b2-style' );

    wp_enqueue_style( 'child-style', B2_CHILD_URI.'/style.css' , array() , B2_VERSION, 'all');
    wp_enqueue_script( 'b2-child', B2_CHILD_URI.'/child.js', array(), B2_VERSION , true );

    if(apply_filters('b2_is_page', 'product')){
        wp_enqueue_style( 'b2-product', PRODUCT_HUNT_THEME_URI.'/ProductHunt/assets/product.css', array(), B2_VERSION , 'all' );
        wp_enqueue_script( 'b2-product', PRODUCT_HUNT_THEME_URI.'/ProductHunt/assets/product.js', array(), B2_VERSION , 'all' );
    }
}

//add product hunt custom post type and custom taxonomy

require_once __DIR__.'/ProductHunt/filters.php';
require_once __DIR__.'/ProductHunt/constants.php';
require_once __DIR__.'/ProductHunt/register-product-hunt.php';
require_once __DIR__.'/ProductHunt/register-api-endpoints.php';
require_once __DIR__.'/ProductHunt/add-product-hunt-fields.php';